The time_t datatype is a data type in the ISO C library defined for storing system time values. Such values are returned from the standard time library function. This type is a typedef defined in the standard <time.h> header.
ISO C defines time_t as an arithmetic type, but doesn't specify any particular type, range, resolution, or encoding for it. Also unspecified are the meanings of arithmetic operations applied to time values.
Unix and POSIX-compliant systems implement the time_t type as a signed integer (typically 32 or 64 bits wide) which represents the number of seconds since the start of the Unix epoch: midnightUTC of January 11970 (not counting leap seconds). Some systems support negative time values, while others do not. 32 bit time_t is deprecated, due to the Year 2038 problem.
In addition to the time function, ISO C also specifies other functions and types for converting time_tsystem time values into calendar times and vice versa.
Example
The following C code retrieves the current time, formats it as a string, and writes it to the standard output.
include
include
int main(void)
time_t parties
Unix enthusiasts have a history of holding time_t parties to celebrate significant values of the Unix time number. These are directly analogous to the new year celebrations that occur at the change of year in many calendars. As the use of Unix time has spread, so has the practice of celebrating its milestones. Usually it's time values that are round numbers in decimal that are celebrated, following the Unix convention of viewing time_t values in decimal. Among some groups round binary numbers are also celebrated, such as +230 which occurred at 13:37:04 UTC on January 10, 2004.
The events that these celebrate are typically described as "N seconds since the Unix epoch", but this is inaccurate. As discussed above, due to the handling of leap seconds in Unix time, the number of seconds elapsed since the Unix epoch is slightly greater than the Unix time number, for times later than the epoch.
At 01:46:40 UTC on September 9, 2001, the Unix billennium (Unix time number 1000000000) was celebrated.
At 01:58:31 UTC on March 18, 2005, the Unix time number reached 1111111111.
At 23:31:30 UTC on February 13, 2009, a celebration is expected as the Unix time number reaches 1234567890 seconds. This day happens to fall on Friday the 13th on the Gregorian calendar. The UNIX time number 0x50000000 (1342177280 seconds) will also happen on a Friday the 13th, at 12:01:20 UTC on July 13, 2012.
At 03:33:20 UTC on May 182033, the second billennium will be celebrated (Unix time number 2000000000).
Do you know how hard it is to get a link from a large encyclopaedia? Well we're different and will prove it. To get a link from us just add the following HTML to your site on a relevant page:
<a href="http://time_t.totallyexplained.com">Time t Totally Explained</a>
Then simply click through this link from your web page. Our crawlers will verify your link, extract the title of your web page and instantly add a link back to it. If you like you can remove the words Totally Explained and embed the link in article text.
As long as your link remains in place, we'll keep our link to you right here. Please play fair - our crawlers are watching. Your site must be closely related to this one's topic. Any kind of spamming, dubious practises or removing the link will result in your link from us being dropped and, potentially, your whole site being banned.